<% import org.codehaus.groovy.grails.orm.hibernate.support.ClosureEventTriggeringInterceptor as Events %>
<%=packageName%>
<HTML>
 <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <meta name="layout" content="main" />
        <title>查询${className}</title>
</head>

<body>
<!--Search Area  -->	  

	  <h1>新增${className}</h1>
            <g:if test="\${flash.message}">
            <div class="message">\${flash.message}</div>
            </g:if>
            <g:hasErrors bean="\${${propertyName}}">
            <div class="errors">
                <g:renderErrors bean="\${${propertyName}}" as="list" />
            </div>
            </g:hasErrors>
            <g:form name="searchArea">
                <div class="dialog">
                    <table>
                        <tbody>
                        <%
                            excludedProps = ['version',
                                             'id',
                                               Events.ONLOAD_EVENT,
                                               Events.BEFORE_DELETE_EVENT,
                                               Events.BEFORE_INSERT_EVENT,
                                               Events.BEFORE_UPDATE_EVENT]
                            props = domainClass.properties.findAll { !excludedProps.contains(it.name) }

                            Collections.sort(props, comparator.constructors[0].newInstance([domainClass] as Object[]))
							int count = 0;
                            props.each { p ->
                                if(!Collection.class.isAssignableFrom(p.type)) {
                                    cp = domainClass.constrainedProperties[p.name]
                                    display = (cp ? cp.display : true)        
                                    if(display) {
										if(count % 2 == 0){
						%>
                            <tr class="prop">
                                <td valign="top" class="name" width="18%">
                                    <label for="${p.name}">${p.naturalName}:</label>
                                </td>
                                <td valign="top" class="value \${hasErrors(bean:${propertyName},field:'${p.name}','errors')}" width="32%">
                                    ${renderEditor(p)}
                                </td>
						<%				
										}else{
						%>
                                <td valign="top" class="name" width="18%">
                                    <label for="${p.name}">${p.naturalName}:</label>
                                </td>
                                <td valign="top" class="value \${hasErrors(bean:${propertyName},field:'${p.name}','errors')}" width="32%">
                                    ${renderEditor(p)}
                                </td>
                            </tr> 
                        <%		  		}
										count++;
									}
								}
							}
							if(count % 2 != 0){
						%>
                                <td colspan="2">&nbsp;
                                </td>
							</tr>
						<%
							}
						%>
                        </tbody>
                    </table>
                </div>
                
               <!--operation area--> 
                <div class="buttons">
                    <span class="button"><input class="save" type="button" onclick="javascript:doSearch();" value="查询" /></span>
					<span class="button"><input class="formbutton" type="reset" value="重置" /></span>
                </div>
            </g:form>

<!--List Area  -->
<div class="listArea">
<iframe frameborder="0" height="55%" width="80%" scrolling="no" name="tabList" src="list"></iframe>
</div>	
</body>
</HTML>
